var ws,order_id,statu;
var app = angular.module('app',[]);
app.controller('my_controller',function($scope,$http){
	$scope.intview = function(){
		 console.log(order_id)
		$scope.statu = statu;
		plus.nativeUI.showWaiting('加载中...');
		$http({
			method:'post',
			url:apiRoot,
			data:{
				action:'User.getOrderDetail',
				orderid:order_id		
			}
		}).then(function success(result){
			$scope.res = result.data.data;  
			$scope.address = result.data.data.info;
			plus.nativeUI.closeWaiting();
		},function errorFunction(e){
			console.log(JSON.stringify(e));
			plus.nativeUI.closeWaiting();
		})
	}
	
	//传ddid给 填写物流单页面 "input_logistics_info.html"
	$scope.send_ddid = function($id){
		plus.webview.create('input_logistics_info.html', 'input_logistics_info.html',{},{order_id:$id}).show('pop-in');
	}
	
	//查看物流信息
	$scope.query_logistics_info = function(name,num){
		plus.webview.create('logistics.html', 'logistics.html',{},{company_name:name,order_num:num}).show('pop-in');
	}
	
})

document.addEventListener('plusready',function(){
	ws = plus.webview.currentWebview();
	order_id = ws.order_id;
	statu = ws.type_status;
	appElement = document.querySelector('[ng-controller=my_controller]');
	$scope = angular.element(appElement).scope();
	$scope.intview();
	$scope.$apply();
})

